fix: use absolute paths for credential helper binaries to prevent PATH hijacking#236
Draft
bukinoshita wants to merge 1 commit intomainfrom
Draft
fix: use absolute paths for credential helper binaries to prevent PATH hijacking#236bukinoshita wants to merge 1 commit intomainfrom
bukinoshita wants to merge 1 commit intomainfrom
Conversation
…H hijacking Resolve secret-tool (Linux) and powershell.exe (Windows) to absolute paths before execution, preventing local PATH hijacking attacks that could steal Resend API keys. Linux: - Check trusted paths (/usr/bin, /usr/local/bin, /bin) first - Fall back to /usr/bin/which for resolution - Reject non-absolute paths from which output - Cache resolved paths for subsequent calls - Use absolute /usr/bin/which instead of bare 'which' in isAvailable() Windows: - Construct absolute PowerShell path from %SystemRoot% env var - Default to C:\Windows if SystemRoot is not set Closes BU-627 Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Use absolute paths for credential helpers on Linux and Windows to prevent PATH hijacking and protect Resend API keys. Addresses Linear BU-627.
secret-toolfrom trusted paths (/usr/bin,/usr/local/bin,/bin), fall back to/usr/bin/which, reject non-absolute results, and cache the resolved path. All calls (get,set,delete,isAvailable) now use absolute paths.%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe, defaulting toC:\Windowsif unset. Use this path for bothexecFileandspawn./usr/bin/security).Written for commit 00723e3. Summary will update on new commits.